import { fetch } from '../../../utils/util';

export class Params {
  /** current */
  current?: number;

  /** pageSize */
  pageSize?: number;

  /** sorter */
  sorter?: string;
}

export type ResponseType = Promise<defs.ResultVO<defs.ListResultVO<defs.Menu>>>;

export const URL = '/api/menu/list';

/**
 * @desc 获取菜单列表
 */
export function request(
  params: Params,
  options?: WechatMiniprogram.RequestOption,
): ResponseType {
  let url = '/api/menu/list';

  const fetchOption = Object.assign(
    {
      url: url,
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
      },
      params: params,
    },
    options,
  );
  return fetch(fetchOption);
}
